home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
FINDVAL.TAS
< prev
next >
Wrap
Text File
|
1991-04-28
|
1KB
|
41 lines
{ FINDVAL.TAS
TAS Script to show how you can find the close price when
an RSI value in the past was at a certain level.
If the current RSI is less than or equal to 30, find
the last time the RSI was less than or equal to 30 and
print out the price on that day and the price today.
Requires TAS 3.58 or later.
}
#OUTPUT_FILE 'FINDVAL.LST'
rsi_a : array;
rsi_a = rsi(14);
if rsi_a > 30 RETURN; { Leave script if RSI > 30}
i = quote_count; { Set loop variable to # quotes}
was_above_30 = 0; { Set to 1 when we find RSI > 30}
{
Loop through the rsi array going back from today to the past.
First we have to find an RSI above 30 before we start checking
for an RSI below 30.
Stop looking if we reach day 14 in the quotes, since the RSI
will be undefined on that day.
}
:LOOP
if i <= 14 then RETURN;
if rsi_a[i] > 30 then
was_above_30 = 1;
if was_above_30 = 1 AND rsi_a[i] <= 30 then
GOTO IFOUNDIT;
:NEXTDAY
i = i-1; { go back one day }
GOTO LOOP;
:IFOUNDIT
{ Check if we should put out a heading }
if header_done = 0 THEN
BEGIN
WRITELN(' ---Todays---- ---Prior---- Days in ');
WRITELN('TICKER Close RSI Close RSI Past Date');
header_done = 1;
END;
WRITELN(TICKER,C,rsi_a,C[i],rsi_a[i],' ',int(quote_count-i),
' ',DATESTR(DATES[i]));